package useFn;

import org.springframework.ui.context.Theme;

public class demo5 {
    public static void main(String[] args) throws InterruptedException {
        // 正常方式
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 200; i++) {
                    System.out.println(Thread.currentThread().getName()+i);

                }
            }
        },"线程A");
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 200; i++) {
                    System.out.println(Thread.currentThread().getName()+i);

                }
            }
        },"线程B");
        t1.setPriority(1);
        t2.setPriority(10);

        System.out.println(t1.getPriority());
        System.out.println(t2.getPriority());
        t1.start();
        t2.start();
        // 线程A 后执行完, 线程B先执行完. 但是是 有概率的,一般都是B先执行完. -- 并不是决定,只是概率提高.

    }
}